home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / diff1819.zoo / diff1819.txt < prev   
Encoding:
Text File  |  1993-08-16  |  14.4 KB  |  603 lines

  1. *** 1.8    1993/08/10 20:46:44
  2. --- changes    1993/08/16 23:11:16
  3. ***************
  4. *** 1,6 ****
  5. --- 1,20 ----
  6.   Changes are listed in *reverse* order, most recent changes being
  7.   first.
  8.   
  9. + version 1.09
  10. + biosfs.c:
  11. +     Implement file locking for BIOS devices.
  12. + dosmem.c:
  13. +     Fix the Pexec(200,...) bug (trying to save the command line
  14. +     image must be done *before* the existing program's memory
  15. +     is freed).
  16. + nalloc2.c,util.c:
  17. +     Allow kmalloc()'d memory to be returned to the OS, if possible.
  18. + xbios.c:
  19. +     Dosound() can be called with a negative number as its parameter,
  20. +     in which case it is only an inquiry function.
  21.   version 1.08
  22.   
  23.   dosfile.c,dosdir.c,filesys.c:
  24. *** 1.8    1993/08/10 20:46:44
  25. --- biosfs.c    1993/08/16 23:10:54
  26. ***************
  27. *** 41,46 ****
  28. --- 41,47 ----
  29.   static long    ARGS_ON_STACK bios_select    P_((FILEPTR *f, long p, int mode));
  30.   static void    ARGS_ON_STACK bios_unselect    P_((FILEPTR *f, long p, int mode));
  31.   static long    ARGS_ON_STACK bios_tseek    P_((FILEPTR *f, long where, int whence));
  32. + static long    ARGS_ON_STACK bios_close    P_((FILEPTR *f, int pid));
  33.   
  34.   long    ARGS_ON_STACK null_open    P_((FILEPTR *f));
  35.   long    ARGS_ON_STACK null_write    P_((FILEPTR *f, const char *buf, long bytes));
  36. ***************
  37. *** 63,69 ****
  38.   
  39.   DEVDRV bios_tdevice = {
  40.       bios_topen, bios_twrite, bios_tread, bios_tseek, bios_ioctl,
  41. !     null_datime, null_close, bios_select, bios_unselect
  42.   };
  43.   
  44.   /* device driver for BIOS devices that are not terminals */
  45. --- 64,70 ----
  46.   
  47.   DEVDRV bios_tdevice = {
  48.       bios_topen, bios_twrite, bios_tread, bios_tseek, bios_ioctl,
  49. !     null_datime, bios_close, bios_select, bios_unselect
  50.   };
  51.   
  52.   /* device driver for BIOS devices that are not terminals */
  53. ***************
  54. *** 70,76 ****
  55.   
  56.   DEVDRV bios_ndevice = {
  57.       null_open, bios_nwrite, bios_nread, null_lseek, bios_ioctl,
  58. !     null_datime, null_close, bios_select, bios_unselect
  59.   };
  60.   
  61.   DEVDRV null_device = {
  62. --- 71,77 ----
  63.   
  64.   DEVDRV bios_ndevice = {
  65.       null_open, bios_nwrite, bios_nread, null_lseek, bios_ioctl,
  66. !     null_datime, bios_close, bios_select, bios_unselect
  67.   };
  68.   
  69.   DEVDRV null_device = {
  70. ***************
  71. *** 117,122 ****
  72. --- 118,124 ----
  73.       ushort    flags;            /* flags for device open */
  74.       struct tty *tty;        /* tty structure (if appropriate) */
  75.       struct bios_file *next;
  76. +     short    lockpid;        /* owner of the lock */
  77.   };
  78.   
  79.   struct bios_file BDEV[] = {
  80. ***************
  81. *** 1024,1029 ****
  82. --- 1026,1032 ----
  83.       char *aline;
  84.       short dev;
  85.       int i;
  86. +     struct bios_file *b;
  87.   
  88.       if (mode == FIONREAD) {
  89.           if (bconstat(f->fc.aux))
  90. ***************
  91. *** 1175,1180 ****
  92. --- 1178,1218 ----
  93.               r = 0;
  94.           }
  95.           return r;
  96. +     } else if (mode == F_SETLK || mode == F_SETLKW) {
  97. +         struct flock *lck = (struct flock *)buf;
  98. +         b = (struct bios_file *)f->fc.index;
  99. +         while (b->lockpid && b->lockpid != curproc->pid) {
  100. +             if (mode == F_SETLKW && lck->l_type != F_UNLCK)
  101. +                 sleep(IO_Q, (long)b);
  102. +             else
  103. +                 return ELOCKED;
  104. +         }
  105. +         if (lck->l_type == F_UNLCK) {
  106. +             if (!(f->flags & O_LOCK)) {
  107. +                 DEBUG(("bios_ioctl: wrong file descriptor for UNLCK"));
  108. +                 return ENSLOCK;
  109. +             }
  110. +             if (b->lockpid != curproc->pid)
  111. +                 return ENSLOCK;
  112. +             b->lockpid = 0;
  113. +             f->flags &= ~O_LOCK;
  114. +             wake(IO_Q, (long)b);    /* wake anyone waiting for this lock */
  115. +         } else {
  116. +             b->lockpid = curproc->pid;
  117. +             f->flags |= O_LOCK;
  118. +         }
  119. +     } else if (mode == F_GETLK) {
  120. +         struct flock *lck = (struct flock *)buf;
  121. +         b = (struct bios_file *)f->fc.index;
  122. +         if (b->lockpid) {
  123. +             lck->l_type = F_WRLCK;
  124. +             lck->l_start = lck->l_len = 0;
  125. +             lck->l_pid = b->lockpid;
  126. +         } else {
  127. +             lck->l_type = F_UNLCK;
  128. +         }
  129.       } else {
  130.       /* Fcntl will automatically call tty_ioctl to handle
  131.        * terminal calls that we didn't deal with
  132. ***************
  133. *** 1231,1236 ****
  134. --- 1269,1288 ----
  135.           else if (mode == O_WRONLY && tty->wsel == p)
  136.               tty->wsel = 0;
  137.       }
  138. + }
  139. + static long ARGS_ON_STACK 
  140. + bios_close(f, pid)
  141. +     FILEPTR *f;
  142. +     int pid;
  143. + {
  144. +     struct bios_file *b;
  145. +     b = (struct bios_file *)f->fc.index;
  146. +     if ((f->flags & O_LOCK) && (b->lockpid == pid)) {
  147. +         b->lockpid = 0;
  148. +     }
  149. +     return 0;
  150.   }
  151.   
  152.   /*
  153. *** 1.8    1993/08/10 20:46:44
  154. --- debug.c    1993/08/13 18:41:26
  155. ***************
  156. *** 608,616 ****
  157.           out_device = 2;
  158.           break;
  159.       case 0x3f:        /* F5: dump memory */
  160. !         DUMPMEM(ker);
  161. !         DUMPMEM(core);
  162. !         DUMPMEM(alt);
  163.           break;
  164.       case 0x40:        /* F6: dump processes */
  165.           DUMPPROC();
  166. --- 608,617 ----
  167.           out_device = 2;
  168.           break;
  169.       case 0x3f:        /* F5: dump memory */
  170. !         DUMP_ALL_MEM();
  171. !         break;
  172. !     case 0x58:        /* shift+F5: dump kernel allocated memory */
  173. !         NALLOC_DUMP();
  174.           break;
  175.       case 0x40:        /* F6: dump processes */
  176.           DUMPPROC();
  177. *** 1.8    1993/08/10 20:46:44
  178. --- dosmem.c    1993/08/16 18:28:26
  179. ***************
  180. *** 543,548 ****
  181. --- 543,571 ----
  182.               }
  183.               return mint_errno;
  184.           }
  185. +     /* jr: add Pexec information to PROC struct */
  186. +         strncpy(p->cmdlin, b->p_cmdlin, 128);
  187. +         p->fname[0] = 0;
  188. +         if (mkload) {
  189. +             char tmp[PATH_MAX];
  190. +             char *source = ptr1;
  191. +             tmp[1] = ':';
  192. +             if (source[1] == ':') {
  193. +                 tmp[0] = source[0];
  194. +                 source += 2;
  195. +             } else
  196. +                 tmp[0] = 'A' + curproc->curdrv;
  197. +             if (DIRSEP(source[0]))    /* absolute path? */
  198. +             {
  199. +                 strncpy (&tmp[2], &source[0], PATH_MAX-2);
  200. +                 strcpy (p->fname, tmp);
  201. +             } else {
  202. +                 if (! d_getcwd (&tmp[2], tmp[0] - 'A' + 1, PATH_MAX - 2))
  203. +                     ksprintf (p->fname, "%s\\%s", tmp, source);
  204. +             }
  205. +         }
  206.           if (ptrace)
  207.               p->ptracer = pid2proc(p->ppid);
  208.   
  209. ***************
  210. *** 588,618 ****
  211.           if (p->ptracer)
  212.               p->ctxt[CURRENT].ptrace = 1;
  213.   
  214. -     /* jr: add Pexec information to PROC struct */
  215. -     p->cmdlin[0] = 0;
  216. -     if (mkbase || mkload)
  217. -         strncpy(p->cmdlin, ptr2, 128);
  218. -     p->fname[0] = 0;
  219. -     if (mkload)
  220. -     {
  221. -         char tmp[PATH_MAX];
  222. -         char *source = ptr1;
  223. -         tmp[1] = ':';
  224. -         if (source[1] == ':') {
  225. -             tmp[0] = source[0];
  226. -             source += 2;
  227. -         } else
  228. -             tmp[0] = 'A' + curproc->curdrv;
  229. -         if (DIRSEP(source[0]))    /* absolute path? */
  230. -         {
  231. -             strncpy (&tmp[2], &source[0], PATH_MAX-2);
  232. -             strcpy (p->fname, tmp);
  233. -         } else {
  234. -             if (! d_getcwd (&tmp[2], tmp[0] - 'A' + 1, PATH_MAX - 2))
  235. -                 ksprintf (p->fname, "%s\\%s", tmp, source);
  236. -         }
  237. -     }
  238.       /* set the time/date stamp of u:\proc */
  239.           proctime = timestamp;
  240.           procdate = datestamp;
  241. --- 611,616 ----
  242. ***************
  243. *** 1137,1143 ****
  244. --- 1135,1144 ----
  245.       assert(p != curproc);
  246.   
  247.   /* take the child off both the global and ZOMBIE lists */
  248. +     { short sr = spl7();
  249.       rm_q(ZOMBIE_Q, p);
  250. +     spl(sr);
  251. +     }
  252.   
  253.       if (proclist == p) {
  254.           proclist = p->gl_next;
  255. *** 1.8    1993/08/10 20:46:44
  256. --- mem.c    1993/08/13 18:11:30
  257. ***************
  258. *** 33,46 ****
  259.    */
  260.   
  261.   /* initial number of memory regions */
  262. ! #define NREGIONS 512
  263.   
  264.   /* number of new regions to allocate when the initial ones are used up */
  265. ! #define NEWREGIONS 256
  266.   
  267.   static MEMREGION use_regions[NREGIONS+1];
  268.   MEMREGION *rfreelist;
  269.   
  270.   /* these variables are set in init_core(), and used in
  271.    * init_mem()
  272.    */
  273. --- 33,51 ----
  274.    */
  275.   
  276.   /* initial number of memory regions */
  277. ! #define NREGIONS ((8*1024)/sizeof(MEMREGION))
  278.   
  279.   /* number of new regions to allocate when the initial ones are used up */
  280. ! #define NEWREGIONS ((8*1024)/sizeof(MEMREGION))
  281.   
  282.   static MEMREGION use_regions[NREGIONS+1];
  283.   MEMREGION *rfreelist;
  284.   
  285. + /* variable for debugging purposes; number of times we've needed
  286. +  * to get new regions
  287. +  */
  288. + int num_reg_requests = 0;
  289.   /* these variables are set in init_core(), and used in
  290.    * init_mem()
  291.    */
  292. ***************
  293. *** 342,347 ****
  294. --- 347,353 ----
  295.               newstuff = get_region(core, NEWREGIONS*SIZEOF(MEMREGION), PROT_S);
  296.           newfrees = newstuff ? (MEMREGION *)newstuff->loc : 0;
  297.           if (newfrees) {
  298. +             num_reg_requests++;
  299.               newfrees[NEWREGIONS-1].next = 0;
  300.               newfrees[NEWREGIONS-1].links = 0;
  301.               for (i = 0; i < NEWREGIONS-1; i++) {
  302. ***************
  303. *** 1609,1617 ****
  304. --- 1615,1626 ----
  305.   void
  306.   DUMP_ALL_MEM()
  307.   {
  308. + #ifdef DEBUG_INFO
  309.       DUMPMEM(ker);
  310.       DUMPMEM(core);
  311.       DUMPMEM(alt);
  312. +     FORCE("new memory region descriptor pages: %d", num_reg_requests);
  313. + #endif
  314.   }
  315.   
  316.   void
  317. *** 1.8    1993/08/10 20:46:44
  318. --- nalloc2.c    1993/08/13 20:36:48
  319. ***************
  320. *** 1,5 ****
  321.   /*
  322. !  * Copyright 1992 Atari Corporation. All rights reserved.
  323.    */
  324.   
  325.   /*
  326. --- 1,6 ----
  327.   /*
  328. !  * Copyright 1992,1993 Atari Corporation.
  329. !  * All rights reserved.
  330.    */
  331.   
  332.   /*
  333. ***************
  334. *** 65,75 ****
  335.   void *start;
  336.   long len;
  337.   {
  338. !     struct arena *a = start;
  339.       struct block *b;
  340.   
  341. !     a->a_next = a_first;
  342. !     a_first = a;
  343.       a->a_ffirst = b = (struct block *)(a+1);
  344.       a->a_size = len;
  345.       b->b_next = NULL;
  346. --- 66,82 ----
  347.   void *start;
  348.   long len;
  349.   {
  350. !     struct arena *a;
  351.       struct block *b;
  352.   
  353. !     for (a = a_first; a && a->a_next; a = a->a_next)
  354. !     continue;
  355. !     if (a)
  356. !         a->a_next = (struct arena *)start;
  357. !     else
  358. !         a_first = (struct arena *)start;
  359. !     a = start;
  360. !     a->a_next = NULL;
  361.       a->a_ffirst = b = (struct block *)(a+1);
  362.       a->a_size = len;
  363.       b->b_next = NULL;
  364. ***************
  365. *** 230,244 ****
  366.       fb->b_next = b->b_next;
  367.       }
  368.   
  369. - #if 0
  370.       /* if, after coalescing, this arena is entirely free, Mfree it! */
  371. !     if (a->a_ffirst == a+1 && 
  372.           (a->a_ffirst->b_size + sizeof(struct block)) == a->a_size) {
  373.           NALLOC_DEBUG('!');
  374.           *qa = a->a_next;
  375.           (void)Mfree(a);
  376. -     }
  377.   #endif
  378.   
  379.       return;
  380.   }
  381. --- 237,253 ----
  382.       fb->b_next = b->b_next;
  383.       }
  384.   
  385.       /* if, after coalescing, this arena is entirely free, Mfree it! */
  386. !     if ((struct arena *)a->a_ffirst == a+1 && 
  387.           (a->a_ffirst->b_size + sizeof(struct block)) == a->a_size) {
  388.           NALLOC_DEBUG('!');
  389.           *qa = a->a_next;
  390. + #if 1
  391. +         kfree(a);    /* MiNT -- give back so it can be used by users */
  392. + #else
  393.           (void)Mfree(a);
  394.   #endif
  395. +     }
  396.   
  397.       return;
  398.   }
  399. *** 1.8    1993/08/10 20:46:44
  400. --- proc.c    1993/08/13 22:46:50
  401. ***************
  402. *** 1,6 ****
  403.   /*
  404.   Copyright 1990,1991,1992 Eric R. Smith.
  405. ! Copyright 1992 Atari Corporation.
  406.   All rights reserved.
  407.   */
  408.   
  409. --- 1,6 ----
  410.   /*
  411.   Copyright 1990,1991,1992 Eric R. Smith.
  412. ! Copyright 1992,1993 Atari Corporation.
  413.   All rights reserved.
  414.   */
  415.   
  416. *** 1.8    1993/08/10 20:46:44
  417. --- procfs.c    1993/08/13 22:49:58
  418. ***************
  419. *** 553,558 ****
  420. --- 553,559 ----
  421.   {
  422.       PROC *p;
  423.       extern long mcpu;    /* in main.c */
  424. +     short sr;
  425.   
  426.       p = (PROC *)f->devinfo;
  427.       switch(mode) {
  428. ***************
  429. *** 654,661 ****
  430. --- 655,664 ----
  431.   TRACE(("PTRACEGO: no signal"));
  432.           }
  433.   /* wake the process up */
  434. +         sr = spl7();
  435.           rm_q(p->wait_q, p);
  436.           add_q(READY_Q, p);
  437. +         spl(sr);
  438.           return 0;
  439.       /* jr: PLOADINFO returns information about params passed to Pexec */
  440.       case PLOADINFO:
  441. *** 1.8    1993/08/10 20:46:44
  442. --- util.c    1993/08/13 19:00:52
  443. ***************
  444. *** 1,6 ****
  445.   /*
  446.   Copyright 1990,1991,1992 Eric R. Smith.
  447. ! Copyright 1992 Atari Corporation.
  448.   All rights reserved.
  449.   */
  450.   
  451. --- 1,6 ----
  452.   /*
  453.   Copyright 1990,1991,1992 Eric R. Smith.
  454. ! Copyright 1992,1993 Atari Corporation.
  455.   All rights reserved.
  456.   */
  457.   
  458. ***************
  459. *** 107,113 ****
  460.    * kernel memory allocation routines
  461.    */
  462.   
  463. ! #define KERMEM_THRESHOLD QUANTUM-8
  464.   #define KMAGIC ((MEMREGION *)0x87654321L)
  465.   #define NKMAGIC 0x19870425L
  466.   
  467. --- 107,118 ----
  468.    * kernel memory allocation routines
  469.    */
  470.   
  471. ! #define KERMEM_THRESHOLD (QUANTUM-8)
  472. ! #if 0
  473. ! #define KERMEM_SIZE QUANTUM
  474. ! #else
  475. ! #define KERMEM_SIZE ((KERMEM_THRESHOLD+8)*2)
  476. ! #endif
  477.   #define KMAGIC ((MEMREGION *)0x87654321L)
  478.   #define NKMAGIC 0x19870425L
  479.   
  480. ***************
  481. *** 142,154 ****
  482.           DEBUG(("kmalloc(%lx): nalloc is out of memory",size));
  483.   
  484.       /* If this is commented out, then we fall through to try_getregion */
  485. !         if (0 == (m = get_region(alt, QUANTUM, PROT_S))) {
  486. !             if (0 == (m = get_region(core, QUANTUM, PROT_S))) {
  487.               DEBUG(("No memory for another arena"));
  488.               goto try_getregion;
  489.               }
  490.           }
  491. !         nalloc_arena_add((void *)m->loc,QUANTUM);
  492.           goto tryagain;
  493.           }
  494.       }
  495. --- 147,162 ----
  496.           DEBUG(("kmalloc(%lx): nalloc is out of memory",size));
  497.   
  498.       /* If this is commented out, then we fall through to try_getregion */
  499. !         if (0 == (m = get_region(alt, KERMEM_SIZE, PROT_S))) {
  500. !             if (0 == (m = get_region(core, KERMEM_SIZE, PROT_S))) {
  501.               DEBUG(("No memory for another arena"));
  502.               goto try_getregion;
  503.               }
  504.           }
  505. !         lp = (long *)m->loc;
  506. !         *lp++ = (long)KMAGIC;
  507. !         *lp++ = (long)m;
  508. !         nalloc_arena_add((void *)lp,KERMEM_SIZE);
  509.           goto tryagain;
  510.           }
  511.       }
  512. *** 1.8    1993/08/10 20:46:44
  513. --- xbios.c    1993/08/12 21:38:22
  514. ***************
  515. *** 29,35 ****
  516.    * unexpectedly. So we play some dirty tricks here: the function
  517.    * call is treated like a signal handler, and we take advantage
  518.    * of the fact that no context switches will take place while
  519. !  * in supervisor mode. ASSUMPTION: the user will not choose to
  520.    * switch back to user mode, or if s/he does it will be as part
  521.    * of a longjmp().
  522.    *
  523. --- 29,35 ----
  524.    * unexpectedly. So we play some dirty tricks here: the function
  525.    * call is treated like a signal handler, and we take advantage
  526.    * of the fact that no context switches will take place while
  527. !  * in supervisor mode. ASSTMPTION: the user will not choose to
  528.    * switch back to user mode, or if s/he does it will be as part
  529.    * of a longjmp().
  530.    *
  531. ***************
  532. *** 266,272 ****
  533.   {
  534.       MEMREGION *r;
  535.   
  536. !     if (!no_mem_prot) {
  537.       /* check that this process has access to the memory */
  538.       /* (if not, the next line will cause a bus error) */
  539.           (void)(*((volatile char *)ptr));
  540. --- 266,272 ----
  541.   {
  542.       MEMREGION *r;
  543.   
  544. !     if (!no_mem_prot && ((long)ptr >= 0)) {
  545.       /* check that this process has access to the memory */
  546.       /* (if not, the next line will cause a bus error) */
  547.           (void)(*((volatile char *)ptr));
  548. ***************
  549. *** 281,288 ****
  550.           }
  551.       }
  552.   
  553. !     Dosound(ptr);
  554. !     return 0;
  555.   }
  556.   
  557.   void
  558. --- 281,287 ----
  559.           }
  560.       }
  561.   
  562. !     return call_dosound(ptr);
  563.   }
  564.   
  565.   void
  566. *** 1.8    1993/08/10 20:46:44
  567. --- sproto.h    1993/08/12 21:41:30
  568. ***************
  569. *** 33,38 ****
  570. --- 33,39 ----
  571.   /* syscall.s */
  572.   char * ARGS_ON_STACK lineA0 P_((void));
  573.   void ARGS_ON_STACK call_aes P_((short **));
  574. + long ARGS_ON_STACK call_dosound P_((const void *));
  575.   long ARGS_ON_STACK callout P_((long, ...));
  576.   long ARGS_ON_STACK callout1 P_((long, int));
  577.   long ARGS_ON_STACK callout2 P_((long, int, int));
  578. *** 1.8    1993/08/10 20:46:44
  579. --- version.h    1993/08/12 21:20:36
  580. ***************
  581. *** 1,5 ****
  582.   #define MAJ_VERSION    1
  583. ! #define MIN_VERSION    8
  584.   
  585.   #ifndef MULTITOS
  586.   #define BETA
  587. --- 1,5 ----
  588.   #define MAJ_VERSION    1
  589. ! #define MIN_VERSION    9
  590.   
  591.   #ifndef MULTITOS
  592.   #define BETA
  593.